package 代码记录.指定公司代码练习记录.西安.分值100分;

import java.util.Scanner;

/**
 * @author zx
 * @create 2023-06-28 20:54
 * 滑动窗口：固定窗口
 */
public class 阿里巴巴找黄金宝箱5 {//再看下
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str = sc.nextLine();
        int k = sc.nextInt();
        String[] temp = str.split(",");
        int[] arr = new int[temp.length];
        for(int i = 0;i < arr.length;i++){
            arr[i] = Integer.parseInt(temp[i]);
        }
        int res = Integer.MIN_VALUE;
        if(k == arr.length){//要返回的结果集长度等于数组长度
            int a = 0;
            for(int i = 0;i < arr.length;i++){
                a += arr[i];
            }
            System.out.println(a);
            return;
        }
        for(int left = 0,right = left + k;right < arr.length;left++,right++){
            int sum = 0;
            for(int i = left;i < right;i++){
                sum += arr[i];
            }
            if(sum > res){
                res = sum;
            }
        }
        System.out.println(res);
    }
}
